<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('账户日流水列表')"/>
</head>
<body class="gray-bg">

<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <li>
                            广告主ID：
                            <select id="advertiser" name="advertiser">
                                <option th:each="fund : ${fundList}" th:text="${fund['name']}" th:value="${fund['advertiserId']}" th:field="*{dict.advertiserId}"></option>
                            </select>
                        </li>

                        <li>
                            日期：<input type="text" name="date"/>
                        </li>

                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="btn-group-sm" id="toolbar" role="group">
            <a class="btn btn-danger btn-del btn-del disabled" onclick="$.operate.removeAll()"
               shiro:hasPermission="dsp:fund:remove">
                <i class="fa fa-remove"></i> 删除
            </a>
            <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="dsp:fund:export">
                <i class="fa fa-download"></i> 导出
            </a>
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table" data-mobile-responsive="true"></table>
        </div>
    </div>
</div>
<div th:include="include :: footer"></div>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('dsp:fund:edit')}]];
    var listFlag = [[${@permission.hasPermi('dsp:fund:list')}]];
    var removeFlag = [[${@permission.hasPermi('dsp:fund:remove')}]];
    var prefix = ctx + "dsp/fund/daily";

    $(function () {
        var options = {
            url: prefix + "/list",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            modalName: "账户日流水",
            search: false,
            showExport: true,
            columns: [
                {
                    checkbox: true
                },
                {
                    field: 'id',
                    title: 'ID',
                    visible: false
                },
                {
                    field: 'advertiserId',
                    title: '广告主ID',
                    sortable: true
                },
                {
                    field: 'date',
                    title: '日期',
                    sortable: true
                },
                {
                    field: 'balance',
                    title: '日终结余',
                    sortable: true
                },
                {
                    field: 'cashCost',
                    title: '现金支出',
                    sortable: true
                },
                {
                    field: 'cost',
                    title: '现金余额',
                    sortable: true
                },
                {
                    field: 'frozen',
                    title: '冻结',
                    sortable: true
                },
                {
                    field: 'income',
                    title: '总存入',
                    sortable: true
                },
                {
                    field: 'rewardCost',
                    title: '赠款支出',
                    sortable: true
                },
                {
                    field: 'returnGoodsCost',
                    title: '返货支出',
                    sortable: true
                },
                {
                    field: 'transferIn',
                    title: '总转入',
                    sortable: true
                },
                {
                    field: 'transferOut',
                    title: '总转出',
                    sortable: true
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-info btn-xs ' + listFlag + '" href="#" onclick="detail(\'' + row.advertiserId + '\')"><i class="fa fa-list-ul"></i>交易明细</a> ');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });

    /*账户日流水列表-详细*/
    function detail(advertiserId) {
        var url = prefix + '/detail/' + advertiserId;
        createMenuItem(url, "账户日流水");
    }
</script>
</body>
</html>